#!/bin/bash

version=$V_SERVER

echo "当前工作目录 `pwd`"
echo "镜像版本 ${version}"

MODULES="../../MODULES.fu"

# 删除旧配置文件
rm -rf ./target/*

# 创建新配置文件目录，复制脚本
cat ENVS | while read env
do
  mkdir -p ./target/${env}/config
  chmod +x ./bin/${env}/*.sh
  cp ./bin/${env}/* ./target/${env}/
done

cat ENVS | while read env
do
  cat $MODULES | while read module
  do
    ./variable_injection.sh $module $env
  done
done

scp -r ./target/* root@10.100.232.206:/root/workspace/server/
